package com.example.hello;

import com.example.hello.client.NavTabs.BootstrapNavTabsState;
import com.vaadin.shared.Connector;
import com.vaadin.ui.AbstractComponentContainer;
import com.vaadin.ui.Component;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class BootstrapNavTabs extends AbstractComponentContainer {

    public List<Component> getLinks() {
        List<Component> links = new LinkedList<Component>();
        Iterator<Connector> itr = getState().getLinks().iterator();
        while (itr.hasNext()) {
            links.add((Component) itr.next());
        }

        return links;
    }

    @Override
    protected BootstrapNavTabsState getState() {
        return (BootstrapNavTabsState) super.getState();
    }

    public void addLink(BootstrapNavLink link) {
        getState().addLink(link);
    }

    @Override
    public void replaceComponent(Component oldComponent, Component newComponent) {

    }

    @Override
    public int getComponentCount() {
        return 0;
    }

    @Override
    public Iterator<Component> iterator() {
        return getLinks().iterator();
    }
}
